
package system.base;

import framework.core.*;
import system.SelectManager;
import system.data.*;

/*
	Author    :chengbiao.he
	CreateTime:2008-02-22 13:52:54
*/
public class Position extends PositionBase 
{

//----system generated start----// 	
public Position() 
{
	
}

private static void delete(DBConnection con,String id) throws Exception
{
	Conditions conditions = new Conditions();

	conditions.add(ID,id);
	
	delete(con,TABLE_NAME,conditions);
}
public static Position fetch()
{
	return new Position();
}
public static Position copy(Position srcObj)
{
	Position obj = fetch();
	obj.copyBase(srcObj);
	return obj;
}
public static Position fetch(DBConnection con,String id) throws Exception
{
	Conditions conditions = new Conditions();

	conditions.add(ID,id);
	
	return fetch(con,conditions);
}
public static Position fetch(DBConnection con,Conditions conditions) throws Exception
{
	DBResult result = null;
	try
	{
		result = DBEngine.doSelect(con,"select * from " + TABLE_NAME,conditions);
		java.sql.ResultSet rs = result.getRs();
		Position obj = null;
		if(rs.next())
		{
			obj = fetch(rs);
		}
		return obj;
	}
	finally
	{
		if(result!=null) result.clear() ;
	}
}
public static Position fetch(java.sql.ResultSet rs) throws Exception
{
	Position obj = new Position();
	obj.initObject(rs);
	return obj;
}

//通过货位编码获取货位实例
public static Position fetchByCode(DBConnection con,String code,String warehouseCode) throws Exception
{
	  Conditions conditions = new Conditions();
	  conditions.add(WAREHOUSE_CODE,warehouseCode);
	  conditions.add(CODE,code);
	
	  return fetch(con,conditions);
} 

//通过编码得到名称
public static String getNameByCode(DBConnection con,String code,String warehouseCode) throws Exception
{
    String mReturn = "";
    Position p = fetchByCode(con,code,warehouseCode);
    if (p != null)
    {
        mReturn = p.getName();
    }
    
    return mReturn;
} 

protected void getUnique(DBConnection con) throws Exception
{
		setId(DBEngine.getId(con));
}
//----system generated end----//



//----add by chengbiao.he start----//


//----add by chengbiao.he end----//

}

